//
//  JMconcernSchoolViewMode.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/9/5.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMconcernSchoolViewMode.h"
#import "JMAppNetworkClient.h"
//#import "JMConcernSchool.h"
#import "JMCollegesMode.h"

@interface JMconcernSchoolViewMode ()

+(NSMutableArray *)dataModel:(NSArray *)array;

@end


@implementation JMconcernSchoolViewMode

+ (void) fetchConcerSchoolMessageParametes:(NSDictionary *)dict  block:(ReturnBackMessage)block{
    [JMAppNetworkClient concernSchollListWithInfo:dict complete:^(id data, NSError *error) {
        NSMutableDictionary *downDict = (NSMutableDictionary *)data;
        if([[downDict objectForKey:@"status"] integerValue] == 1){
            NSArray *array = [JMconcernSchoolViewMode dataModel:downDict[@"list"]];
            block(data,error,array);
        }else{
            block(data,error,nil);
        }
    }];
}

+(NSMutableArray *)dataModel:(NSArray *)array{
    NSMutableArray *mArray = [[NSMutableArray alloc]initWithCapacity:0];
    for(int i = 0; i <array.count;i++){
        NSDictionary *dict = array [i];
        JMCollegesMode *mode = [[JMCollegesMode alloc]init];
        mode.accept =dict[@"accept"];
        mode.attention = dict[@"attention"];
        mode.levelString = dict[@"level"];
        mode.title = dict[@"name"];
        mode.logoString = dict[@"logo"];
        mode.collegeId = [dict[@"id"] intValue];
        mode.attention = @"1";
        [mArray addObject:mode];
    }
    return mArray;
    
}


@end
